package com.itheima.controller;


import com.itheima.common.dto.OrderDto;
import com.itheima.common.entity.Result;
import com.itheima.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/order")
public class UserOrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 根据预约id查询预约信息
     * @param id
     * @return
     */
    @PostMapping("/findById")
    public Result findById(@RequestParam Integer id){
        return new Result(true,"查询预约信息成功",orderService.findById(id));
    }

    @PostMapping("/submitOrder")
    public Result submitOrder(@RequestBody OrderDto orderDto){
        return new Result(true,"预约成功",orderService.submitOrder(orderDto));
    }
}
